package com.buka.recipe.common.result;

/**
 * 响应结果生成工具
 */
public class ResultGenerator {

    private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";

    public static Result<?> genSuccessResult() {
        return new Result<>(true);
    }

    public static <T> Result<T> genSuccessResult(T data) {
        return new Result<>(true, data);
    }

    public static <T> Result<T> genSuccessResult(String message, T data) {
        return new Result<>(true, ResultCode.SUCCESS.code(), message, data);
    }

    public static <T> Result<T> genFailResult(Integer code, String message) {
        return new Result<>(false, code, message, null);
    }

    public static <T> Result<T> genFailResult(String message) {
        return new Result<>(false, ResultCode.FAIL.code(), message, null);
    }
}
